package com.caac.core.config;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright caac 2006</p>
 * <p>Company: caac</p>
 * @author <a href="mailto:project@caac.com.cn">Project Group</a>
 * @version 1.0
 */

public class OrderProperty extends LabelConf {
    private static final String ASC = "asc";
    private static final String DESC = "desc";

    private boolean ascend = false;
    private boolean descend = false;
    private Alias alias;

    public void setName(String name) {
        super.setName(name);
        alias = AliasHelper.getAlias(name);
    }

    public void setType(String type) {
        if (type.indexOf(ASC)!=-1) {
            ascend = true;
        } else if (type.indexOf(DESC)!=-1) {
            descend = true;
        }
    }

    public boolean isDef() {
        return ascend || descend;
    }

    public boolean isAscend() {
        return ascend;
    }

    public boolean isDescend() {
        return descend;
    }

    public Alias getAlias() {
        return alias;
    }
}
